//---------------------------------------------------------------------------
#pragma hdrstop
#include "stdafx.h"
#include "EPSO.h"
//---------------------------------------------------------------------------

#pragma package(smart_init)

void EPSO_Class::Process(bool Show, int Chord1, int Chord2, int Chord3, int Chord4)
{
	//FormLearning->EPSOSeries->Clear();
	this->Swarm.Initial();
	this->Swarm.SetChord(Chord1, Chord2, Chord3, Chord4);

	for(int Epoch=0; Epoch<MaxEpoch; Epoch++)
	{
		this->Swarm.Move(true);
		this->Swarm.GetFitness();

		if(Show)
		{
			//FormLearning->EPSOSeries->AddXY(Epoch, this->Swarm.G_Best[0].Fitness);
			this->Swarm.FitnessRecord[Epoch] += this->Swarm.G_Best[0].Fitness;
		}
	}

	if(Show)
	{
		//paint_Bar(true);
		paint_Particle(this->Swarm.G_Best[0], FormLearning->EPSOImg, FormLearning->EPSOSeries->Color);
		FormLearning->EPSOLabel->Caption = "EPSO Fitness: " + IntToStr((int)this->Swarm.G_Best[0].Fitness);
	}
}
